package cn.iocoder.yudao.module.api.dine.vo;

import cn.iocoder.yudao.framework.business.basic.annotation.AdminJsonView;
import cn.iocoder.yudao.framework.business.basic.annotation.AppJsonView;
import cn.iocoder.yudao.framework.business.basic.pojo.vo.MerchantScopeVO;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * 视图对象
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/09/07
 */
@Data
public class DineTimeRangeVO extends MerchantScopeVO {

    @Schema(description = "分类编号")
    @JsonView({AdminJsonView.class, AppJsonView.class})
    private Long categoryId;

    @Schema(description = "分类名称")
    @JsonView({AdminJsonView.class, AppJsonView.class})
    private String categoryName;

    @Schema(description = "时段，JSON数组，如[\"11:00~11:30\"]")
    @JsonView({AdminJsonView.class, AppJsonView.class})
    private List<String> timeRange;

    @Schema(description = "时段")
    @JsonView({AdminJsonView.class, AppJsonView.class})
    private String timeRangeName;

    @SuppressWarnings("unused")
    public String getTimeRangeName() {
        if (timeRangeName == null) {
            StringBuilder builder = new StringBuilder();
            for (String it : timeRange) {
                builder.append(it);
                builder.append(";");
            }
            return builder.toString();
        }
        return timeRangeName;
    }

}
